﻿using DongFangGuoKai.WMSPlatform.Service.BasicApp.Cell;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace DongFangGuoKai.WMSPlatform.WebApi.Controllers.BasicData
{
    [Route("api/[controller]")]
    [ApiController]
    public class CellController : ApiBaseController
    {
        //仓位
        public ICellService CellService { get; }

        public CellController(ICellService cellService)
        {
            CellService = cellService;
        }


        /// <summary>
        /// 批量生成仓位
        /// </summary>
        /// <param name="whId"></param>
        /// <param name="areaId"></param>
        /// <param name="ShelfIds"></param>
        /// <param name="MaxLayer"></param>
        /// <param name="indexColumn"></param>
        /// <param name="MaxColumn"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("BatchCreateCell")]
        public IActionResult BatchCreateCell(int whId, int areaId, List<int> ShelfIds, int MaxLayer, int indexColumn, int MaxColumn)
        {
            string msg = string.Empty;
            var res = CellService.BatchCreateCellAllowErp(out msg, whId, areaId, ShelfIds, MaxLayer, indexColumn, MaxColumn);
            if (!res)
            {
                return Failed(msg);
            }
            return Success();
        }


        [HttpGet]
        [Route("GetCellList")]
        public IActionResult GetCellList(int pageIndex = 1, int pageSize = 50)
        {
            return Success(CellService.GetCellList(pageIndex, pageSize));
        }


        



    }
}
